---
import type { CollectionEntry } from 'astro:content'

import { getCollection, render } from 'astro:content'

import ContentLayout from '../../../layouts/Content.astro'

type Props = CollectionEntry<'guide'>

let guide = Astro.props

let { headings, Content } = await render(guide)

export async function getStaticPaths() {
  let guides = await getCollection('guide')
  return guides.map(currentGuide => ({
    params: {
      slug: currentGuide.id,
    },
    props: currentGuide,
  }))
}
---

<ContentLayout
  path={[
    {
      href: '/guide',
      name: 'Guide',
    },
    {
      href: `/guide/${guide.id}`,
      name: guide.data.title,
    },
  ]}
  editLink={`https://github.com/azat-io/eslint-plugin-perfectionist/tree/main/docs/content/guide/${guide.id}.mdx`}
  {headings}
  {...guide.data}
>
  <Content />
</ContentLayout>
